#!/bin/bash
#linuxsamu
#
name=rabbitmq-server
bin={{ rabbitmq_base }}/sbin/${name}
binctl={{ rabbitmq_base }}/sbin/rabbitmqctl
function start(){
    ${bin} -detached
    echo "${bin} start!"
}

function stop(){
    ${binctl} stop
    echo "${bin} stop!"
}

case "$1" in
    start)
        echo -n "Starting ${bin}"
        start
        ;;
    stop)
        echo -n "Stopping ${bin}"
        stop
        ;;
    restart)
        echo -n "Restarting ${bin}"
        stop
        sleep 1
        start
       ;;
    *)
       echo "Usage: $0 {start|stop|restart}" >&2
       ;;
esac
